using System;

namespace LS.Digitize
{
    public struct WritePropertyScope: IScope
    {
        public IWriter Writer { get; private set; }
        public string Name { get; private set; }
        
        public WritePropertyScope(IWriter writer, string name)
        {
            Writer = writer;
            Name = name;
            writer.StartWriteProperty(name);
        }
        
        public void Dispose()
        {
            Writer.EndWriteProperty(Name);
            Writer = null;
            Name = null;
        }
    }
}